package com.ripta;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class TaskAdapter extends ArrayAdapter<TaskContent>{
	
	private ArrayList<TaskContent> items;
	
	public TaskAdapter(Context context, int textViewResourceId, ArrayList<TaskContent> items) {
        super(context, textViewResourceId, items);
        this.items = items;
	}
	
	@Override
    public View getView(int position, View convertView, ViewGroup parent) {
            View v = convertView;
            if (v == null) {
                LayoutInflater vi = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                v = vi.inflate(R.layout.dataview, null);
            }
            TaskContent o = items.get(position);
            if (o != null) {
                    TextView taskName = (TextView) v.findViewById(R.id.task);
                    if (taskName != null) {
                    	taskName.setText(o.getTask());
                    }
                    
            }
            return v;
    }
	
	

}
